Yearly Archives: 2012
Building on Datapoint: Weather With Icons
9 Magic Methods in PHP
The title is a bit of a red herring as PHP has more than 9 magic methods, but these will get you off to a good start using PHP’s magic methods. It might be magic, but no wands are required!
Ubuntu Icons Directory Routing
File does not exist: /usr/share/apache2/icons/ ...
Which was really odd, because my webroot is somewhere else completely!
Eventually I spotted a /icons
entry in the configuration for mod_alias
in apache, which intercepts all requests to /icons on any virtual host, and rewrites it. Err, thanks? Renaming the directory to “images” solved the problem in this instance, and I hope if you googled for an error message, you will find this page and be able to fix it equally quickly :)
Datapoint: Weather API from the MetOffice
Continue reading
Managing PHP 5.4 Extensions on Ubuntu
aptitude install php5-pear
and then get tangled in dev packages (clue: look which libcurl you have already installed to figure out which of a long list of -dev
packages to choose), managing finally to emerge with a pecl install http
that completes successfully with the words:
configuration option "php_ini" is not set to php.ini location
You should add "extension=http.so" to php.ini
I’ve been using Ubuntu for some time however, and we don’t put settings straight into php.ini
, there’s a directory called /etc/php5/conf.d/
where all the various module configurations live, or you can enable things just for when PHP is called by apache or from the CLI. However today I hopped into /etc/php5/
and saw this:
.
├── apache2
├── cli
├── conf.d
└── mods-available
Hmmm … mods-available
? Continue reading
Unpacking and Editing a Chrome Extension
From MySQL to MailChimp via CSV
Today I needed to pull email addresses for people who had signed up to a thing out of MySQL and into MailChimp so that I could actually email them about the thing. MySQL actually has a very cute feature for exporting the results of an SQL query as a CSV file, which I had to look up to remember how to do it. It goes something like this: Continue reading
Teaching Those Beginning The Journey
A Little More OOP in PHP
This post follows an earlier entry introducing the basics OOP and what that looks like in PHP. This time around we’ll look at some more advanced concepts and some more practical examples of building code, covering use of constructors and how to add access modifiers in to control how calling code can operate on your objects. We’ll also show off how to create static methods and properties and, perhaps more importantly, illustrate applications of these features.